///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version May  4 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#include "mainframe.h"

#include "../ico/mute.xpm"
#include "../ico/play.xpm"
#include "../ico/sound.xpm"

///////////////////////////////////////////////////////////////////////////

MainFrameBase::MainFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxSize( 500,300 ), wxSize( 500,300 ) );
	
	m_menuBar = new wxMenuBar( 0 );
	m_menuFile = new wxMenu();
	wxMenuItem* menuOpenCard;
	menuOpenCard = new wxMenuItem( m_menuFile, wxID_OPENCARD, wxString( _("Open &card...") ) , _("Open card for learning"), wxITEM_NORMAL );
	m_menuFile->Append( menuOpenCard );
	
	wxMenuItem* menuOpenDict;
	menuOpenDict = new wxMenuItem( m_menuFile, wxID_OPENDICT, wxString( _("Open &dict...") ) , _("Open dictionary"), wxITEM_NORMAL );
	m_menuFile->Append( menuOpenDict );
	
	wxMenuItem* m_menuItemLearn;
	m_menuItemLearn = new wxMenuItem( m_menuFile, wxID_INDEX, wxString( _("&Learn") ) , _("Learn a card"), wxITEM_NORMAL );
	m_menuFile->Append( m_menuItemLearn );
	
	wxMenuItem* m_separator1;
	m_separator1 = m_menuFile->AppendSeparator();
	
	wxMenuItem* menuFileExit;
	menuFileExit = new wxMenuItem( m_menuFile, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+X"), wxEmptyString, wxITEM_NORMAL );
	m_menuFile->Append( menuFileExit );
	
	m_menuBar->Append( m_menuFile, _("&File") ); 
	
	m_menuSettings = new wxMenu();
	wxMenuItem* menuSettingsPreferences;
	menuSettingsPreferences = new wxMenuItem( m_menuSettings, wxID_PREFERENCES, wxString( _("&Preferences...") ) , _("Open preferences"), wxITEM_NORMAL );
	m_menuSettings->Append( menuSettingsPreferences );
	
	m_menuBar->Append( m_menuSettings, _("&Settings") ); 
	
	m_menuHelp = new wxMenu();
	wxMenuItem* menuHelpAbout;
	menuHelpAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About...") ) , wxEmptyString, wxITEM_NORMAL );
	m_menuHelp->Append( menuHelpAbout );
	
	m_menuBar->Append( m_menuHelp, _("&Help") ); 
	
	this->SetMenuBar( m_menuBar );
	
	wxBoxSizer* mainSizer;
	mainSizer = new wxBoxSizer( wxVERTICAL );
	
	m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxVERTICAL );
	
	wxFlexGridSizer* fgSizer1;
	fgSizer1 = new wxFlexGridSizer( 1, 3, 0, 0 );
	fgSizer1->AddGrowableCol( 1 );
	fgSizer1->AddGrowableCol( 2 );
	fgSizer1->AddGrowableCol( 3 );
	fgSizer1->SetFlexibleDirection( wxBOTH );
	fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	m_staticText1 = new wxStaticText( m_panel, wxID_ANY, _("Card: "), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText1->Wrap( -1 );
	fgSizer1->Add( m_staticText1, 1, wxALIGN_CENTER_VERTICAL, 5 );
	
	m_staticTextName = new wxStaticText( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextName->Wrap( -1 );
	fgSizer1->Add( m_staticTextName, 1, wxALIGN_CENTER_VERTICAL, 5 );
	
	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxHORIZONTAL );
	
	m_bpButtonPlay = new wxBitmapButton( m_panel, wxID_ANY, wxBitmap( play_xpm ), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
	m_bpButtonPlay->SetToolTip( _("Play sound") );
	
	m_bpButtonPlay->SetToolTip( _("Play sound") );
	
	bSizer3->Add( m_bpButtonPlay, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
	
	m_bpButtonMute = new wxBitmapButton( m_panel, wxID_ANY, wxBitmap( sound_xpm ), wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW );
	
	m_bpButtonMute->SetBitmapDisabled( wxBitmap( mute_xpm ) );
	m_bpButtonMute->SetToolTip( _("Mute toggle") );
	
	m_bpButtonMute->SetToolTip( _("Mute toggle") );
	
	bSizer3->Add( m_bpButtonMute, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
	
	fgSizer1->Add( bSizer3, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
	
	bSizer2->Add( fgSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
	
	m_staticText2 = new wxStaticText( m_panel, wxID_ANY, _("Word or phrase:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText2->Wrap( -1 );
	bSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	m_staticTextWord = new wxStaticText( m_panel, wxID_WORD, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_staticTextWord->Wrap( -1 );
	m_staticTextWord->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	bSizer2->Add( m_staticTextWord, 0, wxALL|wxEXPAND, 5 );
	
	m_staticText3 = new wxStaticText( m_panel, wxID_ANY, _("Translation:"), wxDefaultPosition, wxDefaultSize, 0 );
	m_staticText3->Wrap( -1 );
	bSizer2->Add( m_staticText3, 0, wxALL, 5 );
	
	m_textCtrlTran = new wxTextCtrl( m_panel, wxID_INPUT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
	bSizer2->Add( m_textCtrlTran, 1, wxALL|wxEXPAND, 5 );
	
	m_buttonOk = new wxButton( m_panel, wxID_ANY, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
	bSizer2->Add( m_buttonOk, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxBOTTOM, 5 );
	
	m_panel->SetSizer( bSizer2 );
	m_panel->Layout();
	bSizer2->Fit( m_panel );
	mainSizer->Add( m_panel, 1, wxEXPAND, 5 );
	
	this->SetSizer( mainSizer );
	this->Layout();
	m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) );
	this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ) );
	this->Connect( wxID_OPENCARD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOpenCardClick ) );
	this->Connect( wxID_OPENDICT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOpenDictClick ) );
	this->Connect( wxID_INDEX, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLearnCardClick ) );
	this->Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) );
	this->Connect( wxID_PREFERENCES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesClick ) );
	this->Connect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutClick ) );
	m_bpButtonPlay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnPlayClick ), NULL, this );
	m_bpButtonPlay->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
	m_bpButtonMute->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMuteClick ), NULL, this );
	m_bpButtonMute->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
	m_textCtrlTran->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnTranKeyDown ), NULL, this );
	m_buttonOk->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnOkClick ), NULL, this );
	m_buttonOk->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
}

MainFrameBase::~MainFrameBase()
{
	// Disconnect Events
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrameBase::OnCloseFrame ) );
	this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ) );
	this->Disconnect( wxID_OPENCARD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOpenCardClick ) );
	this->Disconnect( wxID_OPENDICT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnOpenDictClick ) );
	this->Disconnect( wxID_INDEX, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnLearnCardClick ) );
	this->Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnExitClick ) );
	this->Disconnect( wxID_PREFERENCES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnPreferencesClick ) );
	this->Disconnect( wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrameBase::OnAboutClick ) );
	m_bpButtonPlay->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnPlayClick ), NULL, this );
	m_bpButtonPlay->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
	m_bpButtonMute->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnMuteClick ), NULL, this );
	m_bpButtonMute->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
	m_textCtrlTran->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnTranKeyDown ), NULL, this );
	m_buttonOk->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainFrameBase::OnOkClick ), NULL, this );
	m_buttonOk->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( MainFrameBase::OnKeyDown ), NULL, this );
	
}
